use "gtrend_top3.dta", replace 
set scheme plotplain

encode country, generate(ctry)
encode receiver, generate(rc)
tsset rc date

**# Brazil
fre rc if ctry==1
graph twoway tsline search if ctry==1 & rc==11, ///
	lcolor("220 20 60") lpattern("l") ylabel(0(20)100, nogrid labsize(2)) ///
	tline(28oct2018, lcolor(black) lpattern("l")) ///
	tline(7oct2018, lcolor(gs5) lpattern("shortdash")) ///
	tlabel(28sep2018 28oct2018 27nov2018,  labsize(3) format(%tdDD-Mon-CCYY)) 	/// 
	ytitle(" ", size(3.0)) ylabel(, labsize(med)) xtitle("Date", size(3.0)) ///
	title("Portugal", size(4.7)) /// 
	legend(off) graphregion(margin(r+5)) scheme(plotplain) ///
	saving(ctry1a, replace)
	
graph twoway tsline search if ctry==1 & rc==15, ///
	lcolor("220 20 60") lpattern("l") ylabel(0(20)100, nogrid labsize(2)) ///
	tline(28oct2018, lcolor(black) lpattern("l")) ///
	tline(7oct2018, lcolor(gs5) lpattern("shortdash")) ///
	tlabel(28sep2018 28oct2018 27nov2018,  labsize(3) format(%tdDD-Mon-CCYY)) 	/// 
	ytitle(" ", size(3.0)) ylabel(, labsize(med)) xtitle("Date", size(3.0)) ///
	title("Uruguay", size(4.7)) /// 
	legend(off) graphregion(margin(r+5)) scheme(plotplain) ///
	saving(ctry1b, replace)	
	
graph twoway tsline search if ctry==1 & rc==1, ///
	lcolor("220 20 60") lpattern("l") ylabel(0(20)100, nogrid labsize(2)) ///
	tline(28oct2018, lcolor(black) lpattern("l")) ///
	tline(7oct2018, lcolor(gs5) lpattern("shortdash")) ///
	tlabel(28sep2018 28oct2018 27nov2018,  labsize(3) format(%tdDD-Mon-CCYY)) 	/// 
	ytitle(" ", size(3.0)) ylabel(, labsize(med)) xtitle("Date", size(3.0)) ///
	title("Argentina", size(4.7)) /// 
	legend(off) graphregion(margin(r+5)) scheme(plotplain) ///
	saving(ctry1c, replace)	

graph combine ctry1a.gph ctry1b.gph ctry1c.gph , title("{bf: Jair Bolsonaro}", size(large)) graphregion(margin(zero)) r(1) saving(ctry1.gph, replace)

		
	
**# India
fre rc if ctry==2
graph twoway tsline search if ctry==2 & rc==14, ///
	lcolor("220 20 60") lpattern("l") ylabel(0(20)100, nogrid labsize(2)) ///
	tline(1jun2024, lcolor(black) lpattern("l")) ///
	tlabel(2may2024 1jun2024 1july2024,  labsize(3) format(%tdDD-Mon-CCYY)) 	/// 
	ytitle(" ", size(3.0)) ylabel(, labsize(med)) xtitle("Date", size(3.0)) ///
	title("United Arab Emirates", size(4.7)) /// 
	legend(off) graphregion(margin(r+5)) scheme(plotplain) ///
	saving(ctry2a, replace)
	
graph twoway tsline search if ctry==2 & rc==7, ///
	lcolor("220 20 60") lpattern("l") ylabel(0(20)100, nogrid labsize(2)) ///
	tline(1jun2024, lcolor(black) lpattern("l")) ///
	tlabel(2may2024 1jun2024 1july2024,  labsize(3) format(%tdDD-Mon-CCYY)) 	/// 
	ytitle(" ", size(3.0)) ylabel(, labsize(med)) xtitle("Date", size(3.0)) ///
	title("Nepal", size(4.7)) /// 
	legend(off) graphregion(margin(r+5)) scheme(plotplain) ///
	saving(ctry2b, replace)	
	
graph twoway tsline search if ctry==2 & rc==12, ///
	lcolor("220 20 60") lpattern("l") ylabel(0(20)100, nogrid labsize(2)) ///
	lcolor("220 20 60") lpattern("l") ylabel(0(20)100, nogrid labsize(2)) ///
	tline(1jun2024, lcolor(black) lpattern("l")) ///
	tlabel(2may2024 1jun2024 1july2024,  labsize(3) format(%tdDD-Mon-CCYY)) 	/// 
	ytitle(" ", size(3.0)) ylabel(, labsize(med)) xtitle("Date", size(3.0)) ///
	title("Qatar", size(4.7)) /// 
	legend(off) graphregion(margin(r+5)) scheme(plotplain) ///
	saving(ctry2c, replace)	

graph combine ctry2a.gph ctry2b.gph ctry2c.gph , title("{bf: Narendra Modi}", size(large)) graphregion(margin(zero)) r(1) saving(ctry2.gph, replace)
	
graph combine ctry1.gph ctry2.gph, r(2) 
graph export "gt_top3_ctry1+2.png", replace		

	
**# Philippines
fre rc if ctry==3
graph twoway tsline search if ctry==3 & rc==12, ///
	lcolor("220 20 60") lpattern("l") ylabel(0(20)100, nogrid labsize(2)) ///
	tline(9may2016, lcolor(black) lpattern("l")) ///
	tlabel(9apr2016 9may2016 8jun2016,  labsize(3) format(%tdDD-Mon-CCYY)) 	/// 
	ytitle(" ", size(3.0)) ylabel(, labsize(med)) xtitle("Date", size(3.0)) ///
	title("Qatar", size(4.7)) /// 
	legend(off) graphregion(margin(r+5)) scheme(plotplain) ///
	saving(ctry3a, replace)

graph twoway tsline search if ctry==3 & rc==14, ///
	lcolor("220 20 60") lpattern("l") ylabel(0(20)100, nogrid labsize(2)) ///
	tline(9may2016, lcolor(black) lpattern("l")) ///
	tlabel(9apr2016 9may2016 8jun2016,  labsize(3) format(%tdDD-Mon-CCYY)) 	/// 
	ytitle(" ", size(3.0)) ylabel(, labsize(med)) xtitle("Date", size(3.0)) ///
	title("United Arab Emirates", size(4.7)) /// 
	legend(off) graphregion(margin(r+5)) scheme(plotplain) ///
	saving(ctry3b, replace)
	
graph twoway tsline search if ctry==3 & rc==13, ///
	lcolor("220 20 60") lpattern("l") ylabel(0(20)100, nogrid labsize(2)) ///
	tline(9may2016, lcolor(black) lpattern("l")) ///
	tlabel(9apr2016 9may2016 8jun2016,  labsize(3) format(%tdDD-Mon-CCYY)) 	/// 
	ytitle(" ", size(3.0)) ylabel(, labsize(med)) xtitle("Date", size(3.0)) ///
	title("Singapore", size(4.7)) /// 
	legend(off) graphregion(margin(r+5)) scheme(plotplain) ///
	saving(ctry3c, replace)	

graph combine ctry3a.gph ctry3b.gph ctry3c.gph , title("{bf: Rodrigo Duterte}", size(large)) graphregion(margin(zero)) r(1) saving(ctry3.gph, replace)	
	
	
**# Turkey
fre rc if ctry==4
graph twoway tsline search if ctry==4 & rc==2, ///
	lcolor("220 20 60") lpattern("l") ylabel(0(20)100, nogrid labsize(2)) ///
	tline(28may2023, lcolor(black) lpattern("l")) ///
	tline(14may2023, lcolor(gs5) lpattern("shortdash")) ///
	tlabel(28apr2023 28may2023 27jun2023,  labsize(3) format(%tdDD-Mon-CCYY)) 	/// 
	ytitle(" ", size(3.0)) ylabel(, labsize(med)) xtitle("Date", size(3.0)) ///
	title("Azerbaijan", size(4.7)) /// 
	legend(off) graphregion(margin(r+5)) scheme(plotplain) ///
	saving(ctry4a, replace)	

graph twoway tsline search if ctry==4 & rc==16, ///
	lcolor("220 20 60") lpattern("l") ylabel(0(20)100, nogrid labsize(2)) ///
	tline(28may2023, lcolor(black) lpattern("l")) ///
	tline(14may2023, lcolor(gs5) lpattern("shortdash")) ///
	tlabel(28apr2023 28may2023 27jun2023,  labsize(3) format(%tdDD-Mon-CCYY)) 	/// 
	ytitle(" ", size(3.0)) ylabel(, labsize(med)) xtitle("Date", size(3.0)) ///
	title("Yemen", size(4.7)) /// 
	legend(off) graphregion(margin(r+5)) scheme(plotplain) ///
	saving(ctry4b, replace)		

graph twoway tsline search if ctry==4 & rc==5, ///
	lcolor("220 20 60") lpattern("l") ylabel(0(20)100, nogrid labsize(2)) ///
	tline(28may2023, lcolor(black) lpattern("l")) ///
	tline(14may2023, lcolor(gs5) lpattern("shortdash")) ///
	tlabel(28apr2023 28may2023 27jun2023,  labsize(3) format(%tdDD-Mon-CCYY)) 	/// 
	ytitle(" ", size(3.0)) ylabel(, labsize(med)) xtitle("Date", size(3.0)) ///
	title("Cyprus", size(4.7)) /// 
	legend(off) graphregion(margin(r+5)) scheme(plotplain) ///
	saving(ctry4c, replace)		

graph combine ctry4a.gph ctry4b.gph ctry4c.gph , title("{bf: Recep Tayyip Erdoğan}", size(large)) graphregion(margin(zero)) r(1) saving(ctry4.gph, replace)	

graph combine ctry3.gph ctry4.gph, r(2) 
graph export "gt_top3_ctry3+4.png", replace		

	
**# US
fre rc if ctry==5
graph twoway tsline search if ctry==5 & rc==3, ///
	lcolor("220 20 60") lpattern("l") ylabel(0(20)100, nogrid labsize(2)) ///
	tline(8nov2016, lcolor(black) lpattern("l")) ///
	tlabel(9oct2016 8nov2016 8dec2016,  labsize(3) format(%tdDD-Mon-CCYY)) 	/// 
	ytitle(" ", size(3.0)) ylabel(, labsize(med)) xtitle("Date", size(3.0)) ///
	title("Canada", size(4.7)) /// 
	legend(off) graphregion(margin(r+5)) scheme(plotplain) ///
	saving(ctry5a, replace)	

graph twoway tsline search if ctry==5 & rc==8, ///
	lcolor("220 20 60") lpattern("l") ylabel(0(20)100, nogrid labsize(2)) ///
	tline(8nov2016, lcolor(black) lpattern("l")) ///
	tlabel(9oct2016 8nov2016 8dec2016,  labsize(3) format(%tdDD-Mon-CCYY)) 	/// 
	ytitle(" ", size(3.0)) ylabel(, labsize(med)) xtitle("Date", size(3.0)) ///
	title("New Zealand", size(4.7)) /// 
	legend(off) graphregion(margin(r+5)) scheme(plotplain) ///
	saving(ctry5b, replace)		

	graph twoway tsline search if ctry==5 & rc==6, ///
	lcolor("220 20 60") lpattern("l") ylabel(0(20)100, nogrid labsize(2)) ///
	tline(8nov2016, lcolor(black) lpattern("l")) ///
	tlabel(9oct2016 8nov2016 8dec2016,  labsize(3) format(%tdDD-Mon-CCYY)) 	/// 
	ytitle(" ", size(3.0)) ylabel(, labsize(med)) xtitle("Date", size(3.0)) ///
	title("Ireland", size(4.7)) /// 
	legend(off) graphregion(margin(r+5)) scheme(plotplain) ///
	saving(ctry5c, replace)	

graph combine ctry5a.gph ctry5b.gph ctry5c.gph , title("{bf: Donald Trump}", size(large)) graphregion(margin(zero)) r(1) saving(ctry5.gph, replace)		

	
**# Venzezuela
fre rc if ctry==6
graph twoway tsline search if ctry==6 & rc==9, ///
	lcolor("220 20 60") lpattern("l") ylabel(0(20)100, nogrid labsize(2)) ///
	tline(20may2018, lcolor(black) lpattern("l")) ///
	tlabel(20apr2018 20may2018 19jun2018,  labsize(3) format(%tdDD-Mon-CCYY)) 	/// 
	ytitle(" ", size(3.0)) ylabel(, labsize(med)) xtitle("Date", size(3.0)) ///
	title("Nicaragua", size(4.7)) /// 
	legend(off) graphregion(margin(r+5)) scheme(plotplain) ///
	saving(ctry6a, replace)	

graph twoway tsline search if ctry==6 & rc==4, ///
	lcolor("220 20 60") lpattern("l") ylabel(0(20)100, nogrid labsize(2)) ///
	tline(20may2018, lcolor(black) lpattern("l")) ///
	tlabel(20apr2018 20may2018 19jun2018,  labsize(3) format(%tdDD-Mon-CCYY)) 	/// 
	ytitle(" ", size(3.0)) ylabel(, labsize(med)) xtitle("Date", size(3.0)) ///
	title("Colombia", size(4.7)) /// 
	legend(off) graphregion(margin(r+5)) scheme(plotplain) ///
	saving(ctry6b, replace)	
	
graph twoway tsline search if ctry==6 & rc==10, ///
	lcolor("220 20 60") lpattern("l") ylabel(0(20)100, nogrid labsize(2)) ///
	tline(20may2018, lcolor(black) lpattern("l")) ///
	tlabel(20apr2018 20may2018 19jun2018,  labsize(3) format(%tdDD-Mon-CCYY)) 	/// 
	ytitle(" ", size(3.0)) ylabel(, labsize(med)) xtitle("Date", size(3.0)) ///
	title("Panama", size(4.7)) /// 
	legend(off) graphregion(margin(r+5)) scheme(plotplain) ///
	saving(ctry6c, replace)		
	
graph combine ctry6a.gph ctry6b.gph ctry6c.gph , title("{bf: Nicolás Maduro}", size(large)) graphregion(margin(zero)) r(1) saving(ctry6.gph, replace)		
	
graph combine ctry5.gph ctry6.gph, r(2) 
graph export "gt_top3_ctry5+6.png", replace		